﻿<UserControl x:Class="WPF_QC.QA_View.MeasurementReports"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             xmlns:vm="clr-namespace:WPF_QC"
             Name="RptDataDetail"
             d:DesignHeight="550" Width="600">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="16"/>
            <RowDefinition Height="50"/>
            <RowDefinition/>
        </Grid.RowDefinitions>
        <Label x:Name="measRptWindowTitle" FontSize="14" Content="Material Measurement Reports" HorizontalAlignment="Center" VerticalAlignment="Top" Width="215" 
               FontWeight="Bold" Margin="206,4,179,0" Grid.Row="1" Height="26"/>
        <Label x:Name="reportTypeLabel" Content="Choose a report type:" Margin="30,15,442,439" Grid.Row="2"/>
        <Label x:Name="reportTimeFrameLabel" Content="Choose a time frame:" Margin="298,15,179,439" Grid.Row="2"/>

        <ComboBox x:Name="reportTypeComboBox" HorizontalAlignment="Left" Margin="158,15,0,0" Grid.Row="2" VerticalAlignment="Top" 
                   Width="107" Height="25" SelectedValuePath="Content">
            <ComboBoxItem Name="rptTypeAll" IsSelected="True" Content="All Activities"/>
            <ComboBoxItem Name="rptTypeOnTrgt" Content="On Target"/>
            <ComboBoxItem Name="rptTypeMissedTrgt" Content="Missed Target"/>
        </ComboBox>
        <ComboBox x:Name="timeFrameComboBox" HorizontalAlignment="Left" Margin="421,15,0,0" Grid.Row="2" VerticalAlignment="Top" 
                  Width="139" Height="25" SelectionChanged="timeFrameComboBox_SelectionChanged">
            <ComboBoxItem Name="timeFrmPrevMnth" IsSelected="True">Previous Month</ComboBoxItem>
            <ComboBoxItem Name="timeFrmPrevWk">Previous Week</ComboBoxItem>
            <ComboBoxItem Name="timeFrmLst3Mnths">Last 3 Months</ComboBoxItem>
            <ComboBoxItem Name="timeFrmVariable">Variable Time Period</ComboBoxItem>
        </ComboBox>
        <Button x:Name="viewReportButton" Content="View Report" HorizontalAlignment="Left" Margin="258,102,0,0" VerticalAlignment="Top" Width="75" 
                RenderTransformOrigin="0.4,-0.917" Grid.Row="2" Height="22" Click="viewReportButton_Click"/>

        <WrapPanel x:Name="selectTimeFrameWrapPanel" Margin="338,40,28,353" Grid.Row="2" Visibility="Hidden" >
            <StackPanel x:Name="selectTimeStackPanel" Orientation="Horizontal" Height="54" Width="229">
                <StackPanel Height="54" VerticalAlignment="Top" Orientation="Vertical" Width="111">
                    <Label x:Name="startDateLabel" Content="Start Date:" Margin="0,0,40,0" FontSize="10"/>
                    <DatePicker x:Name="startDatePicker" Margin="4,0" SelectedDate="{Binding StartDate}"/>
                </StackPanel>
                <StackPanel x:Name="endDateStackPanel" Height="54" VerticalAlignment="Top" Orientation="Vertical" Width="108">
                    <Label x:Name="endDateLabel" Content="End Date:" HorizontalAlignment="Left" Width="64" FontSize="10"/>
                    <DatePicker x:Name="endDatePicker" Margin="0,0,2,0" SelectedDate="{Binding EndDate}"/>
                </StackPanel>
            </StackPanel>
            <Label x:Name="timeRangeLabel" Content="(up to the last 3 months only)" RenderTransformOrigin="2.974,0.588" FontStyle="Italic" 
                   FontSize="10" Height="28" Width="210" HorizontalContentAlignment="Right"/>
        </WrapPanel>

        <TextBlock x:Name="errorMsgTextBlock" HorizontalAlignment="Left" Margin="19,45,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="309" Height="52" Grid.Row="2"/>
        <Canvas x:Name="reportCanvas" HorizontalAlignment="Left" Height="316" Margin="24,136,0,0" Grid.Row="2" VerticalAlignment="Top" Width="554" Visibility="Hidden">
            <TextBlock x:Name="reportTypeTextBlock" Canvas.Left="100" TextWrapping="Wrap" Height="31" Width="231" Canvas.Top="10"/>
            <Label x:Name="reportTitleLabel1" Content="Report Name:" Canvas.Left="10" Height="31" Width="90" HorizontalContentAlignment="Right" FontWeight="Bold" Canvas.Top="5"/>
            <TextBlock x:Name="reportDateTextBlock" Canvas.Left="395" TextWrapping="Wrap" Canvas.Top="10" Width="149" Height="30"/>
            <Label x:Name="reportTitleLabel2" Content="Dates:" Canvas.Left="336" Width="54" HorizontalContentAlignment="Right" FontWeight="Bold" Canvas.Top="5"/>
            <DataGrid x:Name="reportDatagrid" HorizontalAlignment="Left" VerticalAlignment="Top" Height="219" Width="534" 
                     ItemsSource="{Binding RptData}" AutoGenerateColumns="False" Canvas.Left="10" Canvas.Top="46">
                <DataGrid.Columns>
                    <DataGridTextColumn Binding="{Binding Path=MaterialName}" Width="120" Header="Material Name" />
                    <DataGridTextColumn Binding="{Binding Path=DateTaken}" Width="130" Header="Date Taken" />
                    <DataGridTextColumn Binding="{Binding Path=Pass_Fail}" Width="100" Header="Pass / Fail" />
                    <DataGridTextColumn Binding="{Binding Path=OnTime}" Width="100" Header="On Time" />
                    <DataGridTextColumn Binding="{Binding Path=Delayed}" Width="*" Header="Delayed" />
                </DataGrid.Columns>
            </DataGrid>
            <Button x:Name="printReportButton" Content="Print Report" HorizontalAlignment="Left" VerticalAlignment="Top"
                     Width="75" Grid.Row="2" Height="22" Canvas.Left="242" Canvas.Top="284" Click="printReportButton_Click"/>
        </Canvas>
    </Grid>
</UserControl>
